#!/usr/bin/env python
# -*- coding:utf-8 -*-

from flask_restful import Api

from . import administrator_blueprint
from api_1_0.administratorResource.administratorResource import AdministratorResource
from api_1_0.administratorResource.administratorOtherResource import AdministratorOtherResource

api = Api(administrator_blueprint)

api.add_resource(AdministratorResource, '/<administrator_id>', '', endpoint='Administrator')


# 系统管理员登录
@administrator_blueprint.route('/login', methods=['POST'], endpoint='AdministratorLogin')
def login():
    return AdministratorOtherResource.login()


# 系统用户注册
@administrator_blueprint.route('/register', methods=['POST'], endpoint='AdministratorRegister')
def register():
    return AdministratorOtherResource.administrator_register()

# 修改密码
@administrator_blueprint.route('/modifyPassword', methods=['PUT'], endpoint='AdministratorModifyPassword')
def modify_password():
    return AdministratorOtherResource.modify_password()

# 获取当前登录的系统管理员信息
@administrator_blueprint.route('/me', methods=['GET'], endpoint='AdministratorMe')
def me():
    return AdministratorOtherResource.me()

# 修改头像
@administrator_blueprint.route('/modifyHeadPic', methods=['PUT'], endpoint='AdministratorModifyHeadPic')
def modify_headpic():
    return AdministratorOtherResource.modify_headpic()

# 逻辑删除用户
@administrator_blueprint.route('/delete/<user_id>', methods=['PUT'], endpoint='UserDelete')
def delete_user(user_id):
    return AdministratorOtherResource.logical_delete(user_id)







@administrator_blueprint.route('/update/<administrator_id>', methods=['PUT'], endpoint='AdministratorUpdate')
def update(administrator_id):
    return AdministratorOtherResource.sensitive_update(administrator_id)

